/*******************************************************************************
 *  Copyright (c) 2020-2201 Yichen Science and Tecthnology Co., Ltd.
 *
 *  File   :    common.h
 *  Author :    luomin
 *  E_mail :    luomin5417@qq.com
 *  Date   :    2021/10/28
 *  Desc   :    common header file.
 *
 *  History:
 *  Date                      Modifier                    Content
******************************************************************************/

#ifndef __COMMON_H__
#define __COMMON_H__

#include <stdlib.h>
#include <stdio.h>
#include <stdint.h>
#include <stdbool.h>
#include <assert.h>
#include <errno.h>
#include <signal.h>
#include <string.h>
#include <ctype.h>

#define OKAY   0
#define ERROR -1

#ifdef __cplusplus
extern "C" {
#endif

/*
*  @brief
*  container_of - return the member address of ptr, if the type of ptr is the
*  struct type.
*/
#define container_of(ptr, type, member) \                                                                                                                                                                    
         ((type *)((char *)(ptr) - (unsigned long)(&((type *)0)->member)))

#ifdef __cplusplus
}
#endif


#endif